{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests\n",
    "\n",
    "URL = \"https://api.openai.com/v1/chat/completions\"\n",
    "\n",
    "payload = {\n",
    "\"model\": \"gpt-3.5-turbo\",\n",
    "\"messages\": [{\"role\": \"user\", \"content\": f\"What is the first computer in the world?\"}],\n",
    "\"temperature\" : 1.0,\n",
    "\"top_p\":1.0,\n",
    "\"n\" : 1,\n",
    "\"stream\": False,\n",
    "\"presence_penalty\":0,\n",
    "\"frequency_penalty\":0,\n",
    "}\n",
    "\n",
    "headers = {\n",
    "\"Content-Type\": \"application/json\",\n",
    "\"Authorization\": f\"Bearer {openai.api_key}\"\n",
    "}\n",
    "\n",
    "response = requests.post(URL, headers=headers, json=payload, stream=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "response.content"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
